Compiling Exceptions Correctly (Extended Version)
نویسندگان
چکیده
Exceptions are an important feature of modern programming languages, but their compilation has traditionally been viewed as an advanced topic. In this article we show that the basic method of compiling exceptions using stack unwinding can be explained and verified both simply and precisely, using elementary functional programming techniques. In particular, we develop a compiler for a small language with exceptions, together with a proof of its correctness.
منابع مشابه
Compiling Exceptions Correctly
Exceptions are an important feature of modern programming languages, but their compilation has traditionally been viewed as an advanced topic. In this article we show that the basic method of compiling exceptions using stack unwinding can be explained and verified both simply and precisely, using elementary functional programming techniques. In particular, we develop a compiler for a small lang...
متن کاملCompiling and reasoning about exceptions and interrupts
Exceptions and interrupts are important for programming reliable software systems, yet our methods for reasoning about them are weak. In this thesis we explore the problem of compiling and reasoning about exceptions and interrupts in the context of a simple language. We develop the language in three stages, initially without any form of exceptions, then adding exceptions, and finally adding int...
متن کاملCompiling Exceptions Correctly
An exception compilation scheme that dynamically creates and removes exception handler entries on the stack. A formalization of an article of the same name by Hutton and Wright [1]. 1 Compiling exception handling theory Exceptions imports Main begin 1.1 The source language datatype expr = Val int | Add expr expr | Throw | Catch expr expr consts eval :: "expr ⇒ int option" primrec "eval (Val i) ...
متن کاملSGML and XML Document Grammars and Exceptions
The Standard Generalized Markup Language (SGML) and the Extensible Markup Language (XML) allow users to de ne document type de nitions (DTDs), which are essentially extended context-free grammars expressed in a notation that is similar to extended Backus{Naur form. The right-hand side of a production, called a content model, is both an extended and a restricted regular expression. The semantics...
متن کاملCompiling Natural Semantics Into ML
This paper presents a compilation scheme from natural semantics speciications to ML. Permutations of premises allow, for a class of speciications, a purely functional execution and can reduce non-determinism. This method uses some speciic features of ML, like exceptions , closures and pattern-matching.
متن کامل